home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1996 #1 / Amiga Plus CD - 1996 - No. 1.iso / pd / grafik / xfig_v1.7 / doc / format2.0 < prev    next >
Encoding:
Text File  |  1995-08-22  |  9.3 KB  |  290 lines

  1. NOTE: THIS FILE FORMAT IS OBSOLETE.  THIS DOCUMENT IS ONLY PROVIDED
  2.     FOR BACKWARD COMPATIBILITY AND INFORMATION.
  3.  
  4. The following is the format of fig output for Protocol version 2.0:
  5.  
  6. (1) The very first line is a comment line containing the name and version:
  7.     #FIG 2.0
  8.  
  9.     The character # at the first column of a line indicates that the line
  10.     is a comment line which will be ignored.
  11.  
  12. (2) The first non-comment line consists of two numbers :
  13.  
  14.     int    fig_resolution        (pixels/inch)
  15.     int    coordinate_system    (1 : origin is at the lower left corner
  16.                      2 : Upper left)
  17.  
  18.     Fig_resolution is the resolution fig is using for the current file.
  19.     It may not be the same as screen resolution (which can be higher or
  20.     lower).  I assume that a pixel is square, therefore this number
  21.     represents drawing resolution in both direction.  I've experimented
  22.     with fig automatically changing this number according to the resolution
  23.     of the monitor it is running on (The screen resolution, width and height
  24.     in pixels, not pixel/inch, can be done by doing a ioctl on the /dev/fb).
  25.     I've found that for monitors with higher resolution but same size
  26.     (19" diagonal), I preferred using the pixels for other things than
  27.     having fig occupying most of the screen.  Thus I opted for a fixed
  28.     pixel-per-inch number which make fig window smaller on higher resolution
  29.     monitor (than the standard sun monitor).  This however may change in
  30.     the future version.
  31.  
  32. (3) The rest of the file contains various objects.  An object can be one
  33.     of six classes (or types).
  34.  
  35.       i)    Ellipse which is a generalization of circle.
  36.      ii)    Polyline which includes polygon and box.
  37.     iii)    Spline which includes closed/open control/interpolated spline.
  38.      iv)    Text.
  39.       v)    Arc.
  40.      vi)    Compound object which is composed of one or more objects.
  41.  
  42.     In the following elaboration on object formats, every value of fig
  43.     output are separated by blank characters or new line ('\n').  The
  44.     value of the not-used parameters will be -1.
  45.  
  46.     A number of values are described as unused or not applicable to some
  47.     object even though they are defined for those objects.  These value
  48.     will (hopefully) be used in the future version of fig.  The intention
  49.     of their uses are the following.
  50.  
  51.     Value            Usage
  52.     -----            -----
  53.     area_fill    The gray color for filling object internals.
  54.             Non-TFX:(gray color; 0=no fill,1=white,21=black)
  55.             TFX:    (gray color; 0=no fill,1=black, 5=white)
  56.  
  57.     pen        This will be a structure defining the shape of
  58.             pen used in drawing objects.  It also includes
  59.             the the stipple pattern for line filling.
  60.             The default pen is a circular pen with black
  61.             filling.
  62.  
  63.     thickness    Every pen has the thickness of one.
  64.             Thickness scales the size of a pen. 
  65.  
  66.     depth        This value adds a half dimension to fig.
  67.             It is useful when we have overlapping filled
  68.             objects and we want one to obliterate another.
  69.             An object can have only one depth (including
  70.             compound object).  An object that is in less
  71.             depth can obscure the one with greater depth
  72.             if they overlap.
  73.     
  74.     style        Three line styles are defined.
  75.  
  76.                 0 : SOLID_LINE
  77.                 1 : DASH_LINE
  78.                 2 : DOTTED_LINE
  79.  
  80.     style_val    For dash style, it is the length of a dash.
  81.             For dotted line it indicates the approximated
  82.             gap of consecutive dots. 
  83.     
  84.     radius        For rounded-corner boxes, this is the radius of
  85.             the corners.
  86.  
  87.     (3.1) ELLIPSE
  88.  
  89.     First line :
  90.     type    name            (brief description)
  91.     ----    ----            -------------------
  92.     int    object_code        (always 1)
  93.     int    sub_type        (1 : ellipse defined by radiuses
  94.                      2 : ellipse defined by diameters
  95.                      3 : circle defined by radius
  96.                      4 : circle defined by diameter)
  97.     int    style            (See the end of this section)
  98.     int    thickness        (pixels, not used)
  99.     int    color            (not used)
  100.     int    depth            (not used)
  101.     int    pen            (not used)
  102.     int    area_fill        (gray color)
  103.     float    style_val        (pixels, not used)
  104.     int    direction        (always 1)
  105.     float    angle            (radian, the angle of the x-axis)
  106.     int    center_x, center_y    (pixels)
  107.     int    radius_x, radius_y    (pixels)
  108.     int    start_x, start_y    (pixels; the 1st point entered)
  109.     int    end_x, end_y        (pixels; the last point entered)
  110.  
  111.     (3.2) POLYLINE
  112.  
  113.     First line :
  114.     type    name            (brief description)
  115.     ----    ----            -------------------
  116.     int    object_code        (always 2)
  117.     int    sub_type        (1 : polyline, 2 : box, 
  118.                      3 : polygon, 4 : rounded-corner box)
  119.     int    style            (See the end of this section)
  120.     int    thickness        (pixels, not used)
  121.     int    color            (not used)
  122.     int    depth            (not used)
  123.     int    pen            (not used)
  124.     int    area_fill    *    (gray color)
  125.     float    style_val        (pixels)
  126.     int    radius        **    (pixels, radius of rounded-corner boxes)
  127.     int    forward_arrow        (0: off, 1: on)
  128.     int    backward_arrow        (0: off, 1: on)
  129.  
  130. *  Fill only available for box, polygon and rounded-corner box, not polyline.
  131. ** This component exists only in rounded-corner box object.
  132.  
  133.     Forward arrow line : same as ARC object
  134.  
  135.     Backward arrow line : same as ARC object
  136.  
  137.     Points line :
  138.     type    name            (brief description)
  139.     ----    ----            -------------------
  140.     int    x1, y1            (pixels)
  141.     int    x2, y2            (pixels)
  142.       .
  143.       .
  144.     int    xn, yn            (this will be the same as the 1st
  145.                     point for polygon and box)
  146.     int    x, y            (always 9999, 9999; marks the end of
  147.                     point for polygon and box)
  148.  
  149.     (3.3) SPLINE
  150.  
  151.     First line :
  152.     type    name            (brief description)
  153.     ----    ----            -------------------
  154.     int    object_code        (always 3)
  155.     int    sub_type        (0 : open spline
  156.                      1 : closed spline
  157.                      2 : open interpolated spline
  158.                      3 : closed interpolated spline)
  159.     int    style            (See the end of this section)
  160.     int    thickness        (pixels, not used)
  161.     int    color            (not used)
  162.     int    depth            (not used)
  163.     int    pen            (not used)
  164.     int    area_fill        (gray color)
  165.     float    style_val        (pixels, not used)
  166.     int    forward_arrow        (0: off, 1: on)
  167.     int    backward_arrow        (0: off, 1: on)
  168.  
  169.     Forward arrow line : same as ARC object
  170.  
  171.     Backward arrow line : same as ARC object
  172.  
  173.     Points line : same as POLYLINE object
  174.  
  175.     Control points line (absent if sub_type is 1 or 2) :
  176.     Control points of interpolated spline.  There are two control
  177.     points for each knots.  A section i, of the spline is drawn
  178.     using Bezier cubic with the following four points:
  179.         (x ,y ), (rx ,ry ), (lx      , ly   ), (x   , y   ).
  180.           i  i        i    i      i+1    i+1     i+1   i+1
  181.     For closed interpolated spline the last pair of control points,
  182.     (lxn,lyn) and (rxn,ryn) (which can be ignored), are the same as
  183.     (lx1,ly1) and (rx1,ry1) respectively.
  184.  
  185.     type    name            (brief description)
  186.     ----    ----            -------------------
  187.     float    lx1, ly1        (pixels)
  188.     float    rx1, ry1        (pixels)
  189.     float    lx2, ly2        (pixels)
  190.     float    rx2, ry2        (pixels)
  191.       .
  192.       .
  193.     float    lxn, lyn        (pixels)
  194.     float    rxn, ryn        (pixels)
  195.  
  196.     (3.4) TEXT
  197.     type    name            (brief description)
  198.     ----    ----            -------------------
  199.     int    object             (always 4)
  200.     int    sub_type        (0 : Left justified
  201.                      1 : Center justified
  202.                      2 : Right justified)
  203.     int    font             (font number 0-...)
  204.     int    font_size         (point size)
  205.     int    pen            (not used)
  206.     int    color            (not used)
  207.     int    depth            (not used)
  208.     float    angle            (radian, not used, the angle of the
  209.                     the base line of the string)
  210.     int    font_style        (not used)
  211.     int    height            (pixels)
  212.     int    length            (pixels)
  213.     int    x, y            (pixels, coordinate of the origin
  214.                      of the string.  If sub_type = 0, it is
  215.                      the lower left corner of the string.
  216.                      If sub_type = 1, it is the lower
  217.                      center.  Otherwise it is the lower
  218.                      right corner of the string.)
  219.     char    string[]        (ascii characters; starts after a blank
  220.                     character following the last number and
  221.                     ends before the character '\1'.  This
  222.                     character is not part of the string.
  223.                     Note that the string may contain '\n'.)
  224.     (3.5) ARC
  225.  
  226.     First line :
  227.     type    name            (brief description)
  228.     ----    ----            -------------------
  229.     int    object_code        (always 5)
  230.     int    sub_type        (always    1)
  231.     int    style            (See the end of this section)
  232.     int    line_thickness        (pixels, not used)
  233.     int    color            (not used)
  234.     int    depth            (not used)
  235.     int    pen            (not used)
  236.     int    area_fill        (gray color)
  237.     float    style_val        (pixels, not used)
  238.     int    direction        (0 : clockwise, 1 : counterclockwise)
  239.     int    forward_arrow        (0: no forward arrow, 1: on)
  240.     int    backward_arrow        (0: no forward arrow, 1: on)
  241.     float    center_x, center_y    (center of the arc)
  242.     int    x1, y1            (pixels, the 1st point the user entered)
  243.     int    x2, y2            (pixels, the 2nd point)
  244.     int    x3, y3            (pixels, the last point)
  245.  
  246.     Forward arrow line (Optional; absent if forward_arrow is 0) :
  247.     type    name            (brief description)
  248.     ----    ----            -------------------
  249.     int    arrow_type        (not used)
  250.     int    arrow_style        (not used)
  251.     float    arrow_thickness        (not used)
  252.     float    arrow_width        (pixels)
  253.     float    arrow_height        (pixels)
  254.  
  255.     Backward arrow line (Optional; absent if backward_arrow is 0) :
  256.     type    name            (brief description)
  257.     ----    ----            -------------------
  258.     int    arrow_type        (not used)
  259.     int    arrow_style        (not used)
  260.     float    arrow_thickness        (not used)
  261.     float    arrow_width        (pixels)
  262.     float    arrow_height        (pixels)
  263.  
  264.     (3.6) COMPOUND
  265.  
  266.     A line with object code 6 signifies the start of a compound.
  267.     There are four more numbers on this line which indicate the
  268.     upper right corner and the lower left corner of the bounding
  269.     box of this compound.  A line with object code -6 signifies
  270.     the end of the compound.  Compound may be nested.
  271.  
  272.     First line :
  273.     type    name            (brief description)
  274.     ----    ----            -------------------
  275.     int    object_code        (always 6)
  276.     int    upperright_corner_x    (pixels)
  277.     int    upperright_corner_y    (pixels)
  278.     int    lowerleft_corner_x    (pixels)
  279.     int    lowerleft_corner_y    (pixels)
  280.  
  281.     Subsequent lines :
  282.     objects
  283.     .
  284.     .
  285.  
  286.     Last line :
  287.     -6
  288.  
  289.  
  290.